﻿using System.Collections;
using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading;
using System.Windows;
using System.Windows.Media;
using System.Windows.Shapes;
using Caliburn.Micro;
using ThunderboltCustomControlLibrary;
using System.Windows.Controls;
using System.Windows.Documents;
using HandyControl.Controls;
using System.Collections.Generic;
using System.Reflection;
using System.Resources;
using System.Windows.Input;
using System.Windows.Media.Imaging;
using HandyControl.Data;
using ThunderboltInterfaceSharp.Views.UserControls;
using System.Threading.Tasks;

namespace ThunderboltInterfaceSharp.ViewModels.UserControls.CloudDisk;

public class CloudDiskSidebarViewModel : Screen
{

	public ObservableCollection<IconPathValueButton> ItemCollection { get; set; } = new ObservableCollection<IconPathValueButton>();

	public CloudDiskSidebarViewModel()
	{

	

	}


	protected override void OnViewLoaded(object view)
	{
		base.OnViewLoaded(view);
		//todo:整合到通用方法类
		var resource = new ResourceManager("ThunderboltInterfaceSharp.Language.StringResource", Assembly.GetExecutingAssembly());
		List<(string,GeometryGroup)> aList = new List<(string,GeometryGroup)> ();
		var icon = new GeometryGroup();

		var dic = new ResourceDictionary { Source = new Uri("././Resources/Styles/GeometryStyle.xaml", UriKind.Relative) };
		foreach (DictionaryEntry it in dic)
		{
			var key = it.Key.ToString();
			var value = it.Value;
			icon = value as GeometryGroup;
			aList.Add((key, icon));
			//value.Bounds
		}
		var dicArray = new DictionaryEntry[100];
		dic.CopyTo(dicArray, 0);
		var geometryCollection = dicArray.ToList();
		var id = Thread.CurrentThread.ManagedThreadId;
		ItemCollection = new ObservableCollection<IconPathValueButton>()
		{
			 new IconPathValueButton()
			{
			Content = resource.GetObject("Recent",Thread.CurrentThread.CurrentCulture),
			Background = Brushes.Transparent,
			BorderThickness = new Thickness(0),
			VerticalContentAlignment = System.Windows.VerticalAlignment.Center,
			HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center,
			FontSize = 13,Width = 57,
			IsPanelVisible = true,
			Cursor =Cursors.Hand,
			Icon =  (aList
				.FirstOrDefault(s => s.Item1.ToString().Equals("RecentGeometryGroup")).Item2),
		IconMargin = new Thickness(5),
			Foreground = Brushes.DarkGray,
			Orientation = Orientation.Horizontal,
			IconSize = 18,
			Height = 50
			},
			 new IconPathValueButton()
			 {
				 Content = resource.GetObject("Video",Thread.CurrentThread.CurrentCulture),
				 VerticalContentAlignment = System.Windows.VerticalAlignment.Center,
				 HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center,
				 FontSize = 13,Width = 57,
				 IsPanelVisible = true,
				 Cursor =Cursors.Hand,

				 Icon =  (aList
					 .FirstOrDefault(s => s.Item1.ToString().Equals("VideoGeometryGroup")).Item2),
				 IconMargin = new Thickness(5),
				 Foreground = Brushes.DarkGray,
				 Orientation = Orientation.Horizontal,
				 IconSize = 18,
				 Height = 50
			 },
			 new IconPathValueButton()
			 {
				 Content = resource.GetObject("Images",Thread.CurrentThread.CurrentCulture),
				 IsPanelVisible = true,
				 Cursor =Cursors.Hand,

				 VerticalContentAlignment = System.Windows.VerticalAlignment.Center,
				 HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center,
				 FontSize = 13,Width = 57,
				 Icon =  (aList
					 .FirstOrDefault(s => s.Item1.ToString().Equals("ImageGeometryGroup")).Item2),
				 IconMargin = new Thickness(5),
				 Foreground = Brushes.DarkGray,
				 Orientation = Orientation.Horizontal,
				 IconSize = 18,
				 Height = 50
			 }
			
		};
		var Ss = (aList
			.FirstOrDefault(s => s.Item1.ToString().Equals("FilmVaultGeometryGroup")).Item2);
		//var s = (geometryCollection
		//	.FirstOrDefault(s => s.Key.ToString().Equals("FilmVaultGeometryGroup")).Value.ToString());
		//var g = //Path里面有Geometry属性，Path是Geometry图像的载体
		//	Geometry.Parse(geometryCollection
		//		.FirstOrDefault(s => s.Key.ToString().Equals("FilmVaultGeometryGroup")).Value.ToString());
	

		
	}

	public void BtnComputerHover()
	{

	}

	public void BtnPhoneHover()
	{

	}
}
